package com.xcexample.electronicclasscard.main

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.xcexample.electronicclasscard.R


class ClassAdapter :
    BaseQuickAdapter<HomeResponse.Course.Weeks.Content, BaseViewHolder>(R.layout.item_class) {

    var select = 0
    override fun convert(helper: BaseViewHolder, item: HomeResponse.Course.Weeks.Content) {
        helper.setText(R.id.chapter, item.chapter)
        helper.setText(R.id.title, item.title)
        helper.setText(R.id.teacher, item.teacher + "｜" + (item.time?:""))
        var view = helper.getView<TextView>(R.id.tv_double)

        if (item.is_single == 1 || item.is_double == 1) {
            helper.setVisible(R.id.tv_double, true)
            if (item.is_single == 1) {
                view.setBackgroundResource(R.drawable.shape_oval_ffbd21)
            } else {
                view.setBackgroundResource(R.drawable.shape_oval_6d5dd3)
            }
        } else {
            helper.setVisible(R.id.tv_double, false)
        }

    }
}
